package com.jwsoft.manager.core.gateway.controller;

import com.bifang.assistant.common.constants.Validators;
import com.bifang.engine.assistant.core.domain.AppResponse;
import com.bifang.engine.protect.core.annotation.Idempotent;
import com.bifang.module.system.common.vo.appArticle.AppArticleStatusVO;
import com.github.pagehelper.PageInfo;
import com.jwsoft.manager.common.vo.eduEnrollmenBrochure.*;
import com.jwsoft.manager.common.vo.eduFormSpecial.EduFormSpecialVO;
import com.jwsoft.manager.common.vo.eduStudentEnrollPre.EnrollSubmitVO;
import com.jwsoft.manager.core.integration.EduEnrollmenBrochureIntegration;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.tags.Tag;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

/**
 * 各学校招生简章网关
 *
 * @author chenchao
 * @since 2023-01-11
 */
@RestController
@RequestMapping(value = "/doc/api")
@Tag(name = "各学校招生简章", description = "各学校招生简章")
public class EduEnrollmenBrochureController {

    @Autowired
    public EduEnrollmenBrochureIntegration eduEnrollmenBrochureIntegration;

    @Operation(summary = "各学校招生简章分页查询",description = "各学校招生简章分页查询")
    @PostMapping(value = "/Eduenrollmen0001", produces = "application/json;charset=UTF-8")
    public AppResponse<PageInfo<EnrollmenBrochureVO>> getList(@RequestBody @Validated EnrollmenQueryVO vo) {
        return AppResponse.successData(eduEnrollmenBrochureIntegration.getList(vo));
    }

    @Operation(summary = "各学校招生简章根据主键查询详情",description = "各学校招生简章根据主键查询详情")
    @PostMapping(value = "/Eduenrollmen0002", produces = "application/json;charset=UTF-8")
    public AppResponse<EnrollmenBrochureVO> getById(@RequestBody @Validated EduEnrollmenBrochureKeyVO vo) {
        return AppResponse.successData(eduEnrollmenBrochureIntegration.getById(vo));
    }
    @Operation(summary = "管理端查询招生方案详细信息",description = "管理端查询招生方案详细信息")
    @PostMapping(value = "/Eduenrollmen0020", produces = "application/json;charset=UTF-8")
    public AppResponse<EnrollmenBrochureVO> getById(@RequestBody @Validated EduEnrollmenBrochureQueryVO vo) {
        return AppResponse.successData(eduEnrollmenBrochureIntegration.getByIdPc(vo));
    }
    @Idempotent(expire="PT2S") //2秒内防重复提交
    @Operation(summary = "各学校招生简章新增",description = "各学校招生简章新增")
    @PostMapping(value = "/Eduenrollmen0004", produces = "application/json;charset=UTF-8")
    public AppResponse<EduEnrollmenBrochureVO> add(@RequestBody @Validated(value = {Validators.Add.class}) EduEnrollmenBrochureVO vo) {
        return AppResponse.successData(eduEnrollmenBrochureIntegration.add(vo));
    }

    @Operation(summary = "各学校招生简章修改",description = "各学校招生简章修改")
    @PostMapping(value = "/Eduenrollmen0005", produces = "application/json;charset=UTF-8")
    public AppResponse<EduEnrollmenBrochureVO> edit(@RequestBody @Validated(value = {Validators.Edit.class}) EduEnrollmenBrochureVO vo) {
        return AppResponse.successData(eduEnrollmenBrochureIntegration.edit(vo));
    }

    @Operation(summary = "各学校招生简章删除",description = "各学校招生简章删除")
    @PostMapping(value = "/Eduenrollmen0006", produces = "application/json;charset=UTF-8")
    public AppResponse del(@RequestBody @Validated EduEnrollmenBrochureKeyVO vo) {
        eduEnrollmenBrochureIntegration.del(vo);
        return AppResponse.successMsg("删除成功！");
    }

    @Operation(summary = "家长端招生方案信息列表",description = "家长端招生方案信息列表")
    @PostMapping(value = "/" +
            "Eduenrollmen0007", produces = "application/json;charset=UTF-8")
    public AppResponse<PageInfo<EnrollmenBrochureVO>> getEnrollmenList(@RequestBody @Validated EnrollmenQueryVO vo) {
        return AppResponse.successData(eduEnrollmenBrochureIntegration.getEnrollmenList(vo));
    }

    @Idempotent(expire="PT2S") //2秒内防重复提交
    @Operation(summary = "义务教育招生方案及表单草稿转审核中",description = "义务教育招生方案及表单草稿转审核中")
    @PostMapping(value = "/Eduenrollmen0009", produces = "application/json;charset=UTF-8")
    public AppResponse submitEnroll(@RequestBody @Validated EnrollSubmitVO vo) {
        eduEnrollmenBrochureIntegration.submitEnroll(vo);
        return AppResponse.successMsg("审核成功！");
    }
    @Operation(summary = "新增或更新招生方案",description = "新增或更新招生方案")
    @PostMapping(value = "/Eduenrollmen0011", produces = "application/json;charset=UTF-8")
    @Idempotent(expire="PT2S") //2秒内防重复提交
    public AppResponse saveEnroll(@RequestBody @Validated EnrollmenVO vo) {
        return AppResponse.successData(eduEnrollmenBrochureIntegration.saveEnroll(vo));
    }



    @Operation(summary = "驳回招生方案",description = "驳回招生方案")
    @PostMapping(value = "/Eduenrollmen0012", produces = "application/json;charset=UTF-8")
    public AppResponse rejectEnroll(@RequestBody @Validated EnrollmenVO vo) {
        eduEnrollmenBrochureIntegration.rejectEnroll(vo);
        return AppResponse.success();
    }

    @Idempotent(expire="PT2S") //2秒内防重复提交
    @Operation(summary = "义务教育关联特殊通道表单",description = "义务教育关联特殊通道表单")
    @PostMapping(value = "/Eduenrollmen0013", produces = "application/json;charset=UTF-8")
    public AppResponse saveYwSpecialFormInfo(@RequestBody @Validated EduFormSpecialVO vo) {
        eduEnrollmenBrochureIntegration.saveYwSpecialFormInfo(vo);
        return AppResponse.success();
    }

    @Idempotent(expire="PT2S") //2秒内防重复提交
    @Operation(summary = "一键上架",description = "一键上架")
    @PostMapping(value = "/Eduenrollmen0015", produces = "application/json;charset=UTF-8")
    public AppResponse batchPublish(@RequestBody @Validated EnrollmenVO vo) {
        eduEnrollmenBrochureIntegration.batchPublish(vo);
        return AppResponse.success();
    }

    @Operation(summary = "招生方案上下架",description = "招生方案上下架")
    @PostMapping(value = "/Eduenrollmen0016", produces = "application/json;charset=UTF-8")
    public AppResponse editPublish(@RequestBody @Validated AppArticleStatusVO vo) {
        eduEnrollmenBrochureIntegration.editPublish(vo);
        return AppResponse.success();
    }

    @Operation(summary = "招生方案审核",description = "招生方案审核")
    @PostMapping(value = "/Eduenrollmen0017", produces = "application/json;charset=UTF-8")
    public AppResponse auth(@RequestBody @Validated EnrollmenAuthVO vo) {
        eduEnrollmenBrochureIntegration.auth(vo);
        return AppResponse.success();
    }

    @Operation(summary = "招生区域根据schoolId和year查询",description = "招生区域根据schoolId和year查询")
    @PostMapping(value = "/Eduenrollmen0018", produces = "application/json;charset=UTF-8")
    public AppResponse<List<EnrollmenBrochureVO>> getEnrollmenBrochure(@RequestBody @Validated enrollmenBrochureSearchVO vo) {
        return AppResponse.successData(eduEnrollmenBrochureIntegration.getEnrollmenBrochure(vo));
    }

    @Idempotent(expire="PT2S") //2秒内防重复提交
    @Operation(summary = "招生区域修改",description = "招生区域修改")
    @PostMapping(value = "/Eduenrollmen0019", produces = "application/json;charset=UTF-8")
    public AppResponse editCoordinate(@RequestBody @Validated(value = {Validators.Edit.class}) enrollmenBrochureUpdateVO vo) {
        eduEnrollmenBrochureIntegration.editCoordinate(vo);
        return AppResponse.success();
    }

    @Operation(summary = "查询招生方案的户籍、房产截止时间",description = "查询招生方案的户籍、房产截止时间")
    @PostMapping(value = "/Eduenrollmen0021", produces = "application/json;charset=UTF-8")
    public AppResponse<EduEnrollmenBrochureVO> queryHjFcEndTime(@RequestBody @Validated EduEnrollmenBrochureQueryVO vo) {
        return AppResponse.successData(eduEnrollmenBrochureIntegration.queryHjFcEndTime(vo));
    }

    @Operation(summary = "招生方案批量审核",description = "招生方案批量审核")
    @PostMapping(value = "/Eduenrollmen0022", produces = "application/json;charset=UTF-8")
    public AppResponse batchAuth(@RequestBody @Validated BatchEnrollmentVO vo) {
        eduEnrollmenBrochureIntegration.batchAuth(vo);
        return AppResponse.success();
    }

    @Operation(summary = "批量招生方案上下架",description = "批量招生方案上下架")
    @PostMapping(value = "/Eduenrollmen0023", produces = "application/json;charset=UTF-8")
    public AppResponse batchEditPublish(@RequestBody @Validated BatchEnrollmentVO vo) {
        eduEnrollmenBrochureIntegration.batchEditPublish(vo);
        return AppResponse.success();
    }

}
